
//
//  HJTitleButton.m
//  12期传智微博HJ
//
//  Created by mac on 15-2-1.
//  Copyright (c) 2015年 jun. All rights reserved.
//

#import "HJTitleButton.h"

@implementation HJTitleButton
- (id)initWithCoder:(NSCoder *)aDecoder
{
    if (self = [super initWithCoder:aDecoder]) {
        [self setup];
    }
    return self;
}
- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self setup];
    }
    return self;
}
- (void)setup
{
    //初始化
    [self setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    
    //图片居中
    self.imageView.contentMode =  UIViewContentModeCenter;
    //标题居中
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    self.titleLabel.x = self.imageView.x;
    self.imageView.x = CGRectGetMaxX(self.titleLabel.frame) + 5;
}
@end
